import time

def s(m,n):
   for i in range(n-1):
       for f in range(n-i-1):
          if m[f] > m[f+1]:
               m[f], m[f+1] = m[f+1], m[f]
             
def re(f):
    file=open(f,'r')
    data=file.readlines()
    return data
#1
m1=re('m1_sorted.txt')
r=len(m1)
t_start=time.time()
s(m1,r)
t_finish=time.time()
print("m1_sorted",round((t_finish-t_start)*1000),'milliseconds')
#2
m2=re('m2_reverse.txt')
r2=len(m1)
t_start=time.time()
s(m2,r2)
t_finish=time.time()
print("m2_reverce",round((t_finish-t_start)*1000),'milliseconds')
#3
m3=re('m3_shuffle.txt')
r3=len(m1)
t_start=time.time()
s(m3,r3)
t_finish=time.time()
print("m3_shuffle",round((t_finish-t_start)*1000),'milliseconds')

